import request from '@/utils/request'

// 查询评论列表
export function listComment(query) {
  return request({
    url: '/system/comment/list',
    method: 'get',
    params: query
  })
}

// 查询评论详细
export function getComment(commentId) {
  return request({
    url: '/system/comment/' + commentId,
    method: 'get'
  })
}

// 新增评论
export function addComment(data) {
  return request({
    url: '/system/comment',
    method: 'post',
    data: data
  })
}

// 修改评论
export function updateComment(data) {
  return request({
    url: '/system/comment',
    method: 'put',
    data: data
  })
}

// 删除评论
export function delComment(commentId) {
  return request({
    url: '/system/comment/' + commentId,
    method: 'delete'
  })
}

// 批量删除评论
export function delComments(commentIds) {
  return request({
    url: '/system/comment/' + commentIds,
    method: 'delete'
  })
}

// 评论状态修改
export function changeCommentStatus(commentId, status) {
  const data = {
    commentId,
    status
  }
  return request({
    url: '/system/comment/changeStatus',
    method: 'put',
    data: data
  })
}

// 审核评论
export function auditComment(commentId, status, reason) {
  const data = {
    commentId,
    status,
    reason
  }
  return request({
    url: '/system/comment/audit',
    method: 'put',
    data: data
  })
}

// 批量审核评论
export function batchAuditComment(commentIds, status, reason) {
  const data = {
    commentIds,
    status,
    reason
  }
  return request({
    url: '/system/comment/batchAudit',
    method: 'put',
    data: data
  })
}

// 导出评论
export function exportComment(query) {
  return request({
    url: '/system/comment/export',
    method: 'post',
    params: query
  })
}

// 获取评论统计
export function getCommentStats(query) {
  return request({
    url: '/system/comment/stats',
    method: 'get',
    params: query
  })
}

// 获取用户评论列表
export function getUserComments(userId, query) {
  return request({
    url: '/system/comment/user/' + userId,
    method: 'get',
    params: query
  })
}

// 获取帖子评论列表
export function getPostComments(postId, query) {
  return request({
    url: '/system/comment/post/' + postId,
    method: 'get',
    params: query
  })
}